# Can't add breakpoint #17

Open
opened this Issue Mar 18, 2013 · 58 comments

None yet

### 10 participants

 I can get chrome to open and start debugging and I have the console working, but when I try to add a breakpoint nothing happens. I have the following errors in the bottom console window: [4560:2672:0318/093557:ERROR:connection.cc(730)] sqlite error 19, errno -2: PRIMARY KEY must be unique [4560:6612:0318/093602:ERROR:textfield.h(162)] NOT IMPLEMENTED Thanks for your hard work, this could potentially be hugely useful.
Owner
 I'll try a simple project, my problem is on Windows 8 btw
 Ok I've tried a very simple project and it still doesn't add breakpoints, any other ideas?
 Hmm when I tried before I was using jQuery from Google's CDN, I downloaded it and breakpoints now work. Does every single script have to be loaded locally, even if you aren't interested in debugging it? If so is there a way around this? I don't always have every script locally on my machine, and I often use the SFTP package to upload to servers etc.
Owner
 Hmm this sound strange. Can you send me a sample project where breakpoints doesn't work?
 Here is the example using the Google jQuery CDN - https://dl.dropbox.com/u/3615425/web_inspector_test.zip
 I'm using Windows 7 and absolutely nothing happens when I use the Add/Remove Breakpoint command.
 I'm on Windows 7 also. Breakpoints work in a simple project, where scripts are included with 
Owner
 @bbeckford you have error in your htm file src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" I fixed it and run from local server on path 'http://localhost/adminui/web_inspector_test/index.htm' and everything works fine! @fencliff could you provide a sample project with RequireJS
 @sokolovstas, silly me! However, it seems in my testing any javascript error will mean I can't add a breakpoint. For example I have a dev site that shows an error due to no linked in api key being set, something I usually ignore whilst I'm building and debugging the rest of the site but would stop me from using web inspector, is this repairable? Thanks
Owner
 @bbeckford please provide more details: what URL entered in browser what URL of debugging file what folder added to sublime project what local file name I believe this is simple file and path errors. Also you can try close tab, open again and then connect inspector.
Owner
 For now now matching algorithm is: Take file url -> "#17.JS" Delete first http and host -> "sokolovstas/SublimeWebInspector/issues/17.JS" Try open file by path "sokolovstas/SublimeWebInspector/issues/17.JS" If can't find remove step by step from url parts splitted by "/" Try open file by path "SublimeWebInspector/issues/17.JS" Try open file by path "issues/17.JS" and so on
 @sokolovstas, I created a repro which shows that the issue was not in RequireJS script loading after all. The problem appears to be that the root folder opened in Sublime Text was the one "above" the web page root, so that my source url in the browser was /file.js, whereas the path in Sublime was /source/file.js. The issue was solved by only opening the source directory in Sublime. This is slightly inconvenient, but definitely manageable. This project is awesome. Thanks for all the good work!
Owner
 You must have at lease one folder with all content because plugin search for files in project folders!
Owner
 @bbeckford I can close issue? All works fine?
referenced this issue Mar 20, 2013
Closed

#### ST3: Issues #26

 OK so I have several instances where this isn't working, in different ways. 1: No errors given by the plugin. Just nothing was happening. In this case I had an error in the script, which was why it wasn't setting a breakpoint. This is bad because when I have errors, I'm more likely to WANT to use a breakpoint to try to figure it out. 2: Similar issue to @fencliff I believe. My project structure looks like this (the structure is the same in #1): Main Folder |-- public | |-- js ........ So the browser's root folder (/) is "public". In this case I get this error in the little console below the inspector: [8196:6920:0320/073456:ERROR:external_registry_loader_win.cc(103)] File C:\Program Files (x86)\OApps\chromeaddon.crx for key Software\Google\Chrome\Extensions\kincjchfokkeneeofpeefomkikfkiedl does not exist or is not readable. 3: Just for kicks, I made "public" the root of the project and tried debugging. If the error that I mentioned in #1 is there, it'll let me put the breakpoint, but when I refresh the browser or do anything, it skips right past the breakpoint. Completely useless. If I fix the error, stop debuggin, start debugging again, try setting a breakpoint, I get a popup error saying "Could not resolve breakpoint". So basically, I've tried everything mentioned in this issue and still nothing works for me.
Owner
 @joezimjs Please provide sample project and path where to place it on localhost. I can't find bugs by description only. I need to test something. PS I have fixed some issues with setting breakpoints on ST3 branch today.
 https://github.com/joe-zim-javascript-blog/ButlerBoss is the project when you run node butlerboss it'll start up the server on localhost:8080
Owner
 Ok I have fixed path issue, now file mapping working fine. Where to try set breakpoint?
 I was just trying to set it in the main.js file.
Owner
 On what line? If on 8 line, there I have Exception and Javascript just falling and breakpoints not work here. But in new version I made a new property "pause_on_exceptions" and it set to "uncaught" if you have uncaught exception debugger will pause there
 Set a breakpoint anywhere that would normally work. If it works, great; if it doesn't then we'll have to figure it out.
Owner
 And debugger paused on line 4, 10, 7, 7 and uncaught Exception and stop
Owner
 Yes, you use sublime 3? You need just restart sublime and packages will be updated
 No I'm on Sublime 2
 Right now I'm getting this in the console: [14268:11872:0321/074231:ERROR:external_registry_loader_win.cc(104)] File C:\Program Files (x86)\OApps\chromeaddon.crx for key Software\Google\Chrome\Extensions\kincjchfokkeneeofpeefomkikfkiedl does not exist or is not readable. [14268:14272:0321/074236:ERROR:textfield.h(162)] NOT IMPLEMENTED
 That's just after trying to start Chrome. Nothing really works after that.
Owner
 I have changed path from version to branch need to wait until wbond package manager reload package.
 I'm not sure what that means. I should just wait?
Owner
 Try to remove package and install it again now.
 Still getting [5200:13428:0321/093815:ERROR:external_registry_loader_win.cc(104)] File C:\Program Files (x86)\OApps\chromeaddon.crx for key Software\Google\Chrome\Extensions\kincjchfokkeneeofpeefomkikfkiedl does not exist or is not readable. [5200:12244:0321/093820:ERROR:textfield.h(162)] NOT IMPLEMENTED
Owner
 This is not a problem if Chrome started correctly and working
Owner
 Also today I have fixed some line number issues and seems it work fine on your project.
 Hi, I've installed this extension "Web Inspector 3" today and am having issues with setting break points (all other features seem to work). I'm on Mac OSX 10.8.3 I've updated the path in "Settings - User" (as I wasn't able to change the setting in the Default for some reason?) to... { "chrome_path": { "osx": "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary" } }  Note: I've since gone back to "Settings - User" and it has changed itself to look like this... { "breaks": { }, "chrome_path": { "osx": "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary" } }  ...notice the extra "breaks" property? My set-up is as follows... index.html file which links to a JavaScript file (both in a /debug/ folder in my localhost directory). The content of my JavaScript file is... var testing = (function() { counter = 0; return function() { console.log(counter); counter++; } }()); window.setInterval(testing, 5000); My localhost directory is found here: /Library/WebServer/Documents So to begin with, within ST3 I run: Cmd+Shift+R and select the option "Start Google Chrome with remote debug port 2222" I then see the following error... [3697:1799:0324/114057:ERROR:content_settings_pref_provider.cc(516)] Invalid pattern strings: [*.]78.109.163.36,* [3697:1799:0324/114057:ERROR:content_settings_pref_provider.cc(400)] Invalid pattern strings: [*.]78.109.163.36,*  I then run Cmd+Shift+R again and this time I choose the option "Add/Remove Breakpoint". My cursor is already on line 6 which is where I wanted to add a break point (counter++;) which then places a black dot on that line (so I assume that has worked?) I then switch over to Chrome Canary and manually enter the URL http://localhost/debug/ I then switch back to ST3 and run Cmd+Shift+R again and this time I choose the option "Start debugging" which displays "http://localhost/debug/" in the list. I select the URL and the inspector within ST3 starts showing me the logging information from my script but doesn't actually break on the breakpoint at all? I then find I can't add another breakpoint unless I stop debugging first. Any ideas on what the issue might be? Thanks.
 Same here. Everything works except for breakpoints. If I set a breakpoint (even for a simple HTML file and script), absolutely nothing happens.
Owner
 @Integralist run "Show file mapping" command and post result here please
 @sokolovstas OK first thing worth noting is that I've retried the above steps on my work laptop (same OS version but it's a 2012 retina macbook, where as above I was testing at home on a 2009 17" macbook pro) but this time I didn't get the error... [3697:1799:0324/114057:ERROR:content_settings_pref_provider.cc(516)] Invalid pattern strings: [*.]78.109.163.36,* [3697:1799:0324/114057:ERROR:content_settings_pref_provider.cc(400)] Invalid pattern strings: [*.]78.109.163.36,*  ...but it still doesn't pause on the break points (thought I'd just let you know in case that error no longer showing was important or not). I ran the Show file mapping command and it opened a new tab with an empty Array: [] on line 1?
Owner
 If mapping is empty no file connected from url to your local file systems. All errors on chrome start doesn't mater! What is your js file url and which folder you add to sublime?
 @sokolovstas I've just checked the "Settings - User" file again (remember for now I'm testing this on my 2012 macbook) and the file changed to... "breaks": { "/Users/markmcdonnell/Desktop/test.js": { "6": { "status": "disabled" } } } ...it now shows my test javascript file. I copied the files to my Desktop and in Chrome manually opened the index.html I copied there
Owner
 You need to add foder to sublime project. Open file do nothing. Plugin search for file to map only in project folders
 @sokolovstas ok I created a project file test.sublime-project within that desktop folder and the inspector now breaks on the breakpoint, but it doesn't actually display the counter value at the break point? See the following image as an example...
Owner
 Does chrome developer tools show this var? This is global variable, you can evaluate it or click on global and see it then
 @sokolovstas Chrome dev tools can access the testing variable yes, but not the counter variable as is made private within the IIFE ('immediately invoked function expression'). The IIFE executes and returns another function to testing which creates a closure so it has access to counter, but counter isn't globally accessible as it's made private.
commented Mar 26, 2013
 Counter is still global in this case, as you did not declare it using var it will be declared on the window scope.
 ^
 @sokolovstas aha! cracked it. thanks -> sorry I didn't realise I hadn't declared counter, my bad. Yes, now that I have declared the variable I can see the breakpoint shows a closure option which I click on and it shows me the counter value. Thanks for the help!
 I didn't want to open another Issue just for this one question: It's not possible to use this plugin for complex Projects at the moment? Like Projects with multiple Virtual Hosts?
Owner
 You can try it and share you thoughts.
 @sokolovstas i want to add a breakpoint but my panel only show two choices one is start debugging the other one is toggle breakpoint .there's no add or delete breakpoint option and when i choose the toggle breakpoint it add one breakpoint which status is disabled
Collaborator
 @Angelkuga Can you please open Sublime, repro the problem, then attach the entire content of the console window (Ctrl-) to this issue. Let me know the URL and filename that this relates to. The problem is most likely that it hasn't successfully mapped your local file to your served file. The diagnostics in the console window will tell us.
 @danmosemsft sorry to reply u late ,this is the picture i captured have a look
 hello Dan Moseley i have replyed u on github . this is the picture i captured u have a look and see what make me can't use web inspector successfully thank u so much On Wed, Jan 6, 2016 at 1:16 AM, Dan Moseley notifications@github.com wrote: Can you please open Sublime, repro the problem, then attach the entire content of the console window (Ctrl-`) to this issue. Let me know the URL and filename that this relates to. The problem is most likely that it hasn't successfully mapped your local file to your served file. The diagnostics in the console window will tell us. — Reply to this email directly or view it on GitHub #17 (comment) . Angelkuga
Collaborator
 Can you please copy the text out of the console and share all of it? It's the black and white region at the bottom of your picture.