javascript - Chrome debugger doesn't stop -
i have added breakpoint following code in line 44 debugger;
. expected chrome stop there every time before console.log("...")
executed. surprise stops 1 time.
to test example:
- run snippet below in chrome
- open chrome dev tools
- drag image website in drop area
at point chrome stops @ breakpoint. if in console should see console.log
statement executed 2 more times.
i know why happens. (threading issue??)
and how can solve if want debug code @ line.
$(document).ready(function() { $('#drop-area').on("dragover", function(event) { event.preventdefault(); event.stoppropagation(); $(this).addclass('dragging'); }); $('#drop-area').on("dragleave", function(event) { event.preventdefault(); event.stoppropagation(); $(this).removeclass('dragging'); }); $('#drop-area').on("drop", function(event) { event.preventdefault(); event.stoppropagation(); var count = 1; var dropobj = event.originalevent.datatransfer; (var = 0; < dropobj.items.length; i++) { var adropitm = dropobj.items[i]; if (adropitm.kind == "file") { //ignore } else { adropitm.getasstring(function(_str) { debugger; //the debugger should stop here every time before string printed console console.log("this called [" + count++ + "] times"); }); } } }); });
#drop-area { background-color: red; width: 400px; height: 400px; }
<div id="drop-area">drop files here...</div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
edit
reported bug here: https://bugs.chromium.org/p/chromium/issues/detail?id=748923
Comments
Post a Comment