Google App Script Debugger not working on ClickHandler callback - debugging

I've followed the Google app script tutorial here which is a very simple script with two functions. showDialog (which presents a dialog box with a text field and submit button ) and respondToSubmit(e) which handles the submit button and adds the entered data to the spreadsheet.
It works fine.
What doesn't seem to work is the debugger on the callback. So I place a breakpoint in both functons and start the showDialog function. The debugger kicks in and stops execution at the breakpoint. I click continue so I can interact with the newly opened dialog box. However when I click the submit button the debugger does not start again. The respondtoSubmit(e) function is executed. The debugger just does not stop on the breakpoint(s).
Is there a problem with debugging callbacks like this or can you only debug one function at a time?

For reference Utilities.jsonStringify(e) is depricated, use JSON.stringify() and JSON.parse() instead.

As of right now, the debugger has some unexpected behaviours. Mostly, it seems to only respect breakpoints during calls from the script editor, so to debug your event handler you must call it from the debugger, not the UI. If you need to peek into variables such as the event object passed to the function, for example, try adding this line to your handler where you'd normally put a breakpoint:
Logger.log(Utilities.jsonStringify(e));
Then view the log from the script editor after execution.

It seems to me that the Logger does not work either, unless run from the script editor. I did manage Browser.msgbox(Utilities.jsonStringify(e)) which had brought the (expected) result:
{"parameter":{"clientY":"45","clientX":"37","eventType":"click","ctrl":"false","meta":"false","source":"u12053277590","button":"1","alt":"false","myTextBox":"babi","screenY":"381","screenX":"598","shift":"false","y":"13","x":"33"}}

Related

Slack Golang attachment button click is not firing interactively

I am using the following example from slack-go at https://github.com/slack-go/slack/blob/62fceeadbaea9ead0f2209e82863b1ca81a24bd8/examples/buttons/buttons.go. I managed to send the attachment as shown in screenshot, but when i click on the button, it seems like both were click but not doing anything. I have tried SocketMode and non-socketmode, the result is still the same. If I use normal button action as Block, then it works, but button action in Attachment doesn't seems to work. I have created /actions in Slash Command as well but still not working. Anyone knows the problem ?
I managed to solve the problem. I just need to add an Interactive Url with ngrok tunnel to my bot server. Initially i created in the Slash Command section but then I realized I need to do it at the Interactive & Shortcuts section. But my main concern is the UI click. When I click on the button, both button grays out, is this normal ?

How do I debug a firefox extension, it seemingly crashes silently

I cannot figure out how to debug my simple extension. Script (a content script) loads (because the first console.log call shows in the tab's console) but then nothing. There's no error what so ever and no second console.log call.
My question is not about solving my code issue (there surely is one, if only firefox would tell me where), it's about finding the place where warnings/errors about the add-on are in firefox (like 'sdfsdf has no object property ...')
about:debugging is no help, the console it can open shows some errors (example: 'Error: Service "domainInfo" is not available. Make sure it appears in the "requiresServices" property of the module's background where is it used.') that have nothing to do with what I'm trying to do (I can tell from the source and nature of errors)
// start of file
console.log('I AM LOADING');
// simple DOM manipulation code here...
console.log('I AM LOADED');
// end of file
The content scripts are supposed to be debugged with the DevTools instance attached to the web page.
However, as you noticed, the errors in the content script are not reported in the tab's Web Console due to a bug. (As of Firefox 70.)
As a workaround you can:
use try..catch with logging,
check the Browser Console (which does show error in the content script)
use the Debugger's "pause on exceptions" option.

Form unload not fired when i am used debugging

I used vb6.6 application and my form unload method not fired when I click ok button. It came from One of my .ocx file control but other cancel button fired because that's not an ocx control button
when in debug mode, events don't fire in the order they normally do. My suggestion is that you use the Debug.Print to send tracking msgs to the immediate window rather than trying to 'step debug' thru that event. Put a break in your code just before your first ( of potentially many ) Debug.Print statements ... then when the debugger stops there, switch out of debug mode and let the code run free, using the messages in the immediate window to tell you what you would have gathered visually while stepping thru the code. Have done this many times, successfully. It takes some patience to get it to work, but once mastered, it works every time.

How to inspect the flow of events with Firebug (or something like that)?

I'm facing an issue with inputs loosing focus. The issue is like this:
I send an AJAX request to load a form, when loaded I display it with in a modal.
Now if I click on any of the inputs it gains focus and blurs immediately, so I need to click it again (and this time it stays focused).
I need a tool that traces the event flow and dispatching in Firebug's console (or some similar tool), so that I can detect the culprit for this odd behavior and fix it.
I have tried Eventbug and FireQuery; but I haven't be able to find the code that causes this.
You may go to scripts panel of Firebug, then hover your mouse over the input, then click ALTCTRLB from the keyboard to activate "Break on next", then click the input, and it should hit a breakpoint in the onclick handler of the input, then you can go through the code to find potential calls that cause blur (provided that you don't do any aggressive polling via setInterval/setTimeout in your javascript for some reason, or the framework you use doesn't; then it'll likely pause in that code).
You may also want to execute some code at the very beginning of the page to override the addEventListener method so that you hijack it: log any calls to it, and forward execution to the original function; see slides 13-14 of my presentation (I do it in Greasemonkey, but it's not relevant here; just make sure this is executed at the very beginning of the page).

pausing execution javascript in code not in google chrome debugger

I am writing a Google Chrome extension. One of my content scripts has a little bug that I can't find and the Google Chrome debugger appears to be useless for this purpose. The code stops on an Uncaught typeError: Cannot set property 'value' of null. I can see this by opening the debugger and viewing the console after the code fails. But my content script does not appear in the list of scripts shown in the debugger at this point. There are a lot of scripts shown there, including a big block of scripts in light blue. But none named "profile.js" which is my content script.
I tried "location.reload(); but it simply returns "undefined." I'd love to step thru this code and find the problem but I can't figure out how to do it. I've set alerts to try to track the problem but once I click on the alert, the script continues with no opportunity to invoke the debugger. Based on the result of the alert experiment, it appears the code is failing at the very end. I presume the code is finished by the time the error is caught and the script is no longer available to the debugger.
I tried adding this line to the script: "debugger;" to try and force the debugger to open but there is no change whatever to the execution of the code. It fails as usual and as usual I can open the debugger, find the console message and the big list of scripts that does not include mine.
How can I pause execution of the code using a line in the code itself? I just want to stop execution of the code at the beginning, invoke the debugger, set up some breakpoints, resume execution and monitor some variables. That seems like a pretty simple and do-able request.
Any ideas?

Resources